package cn.regexp.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

@Setter
@Getter
@TableName("shop_order")
/* 订单 */
public class ShopOrder {

    public static final Integer ORDER_ARREARAGE = 0;           // 未付款
    public static final Integer ORDER_NOT_SEND = 1;            // 待发货
    public static final Integer ORDER_NOT_DELIVERY = 2;        // 待取件/待收货
    public static final Integer ORDER_NOT_EVALUATE = 3;        // 待评价
    public static final Integer ORDER_COMPLETED = 4;           // 已完成
    public static final Integer ORDER_REFUND = 5;              // 已退款
    public static final Integer ORDER_CANCEL = 6;              // 已取消

    public static final Integer PAY_ARREARAGE = 0;             // 未付款
    public static final Integer PAY_ACCOUNT_PAID = 1;          // 已付款
    public static final Integer PAY_REFUND = 2;                // 已退款
    public static final Integer PAY_FAIL = 3;                  // 付款失败

    public static final Integer TYPE_DELIVERY = 0;                  // 配送
    public static final Integer TYPE_SELF_PICK_UP = 1;                  // 自取



    /**
     * 主键
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 订单编号
     */
    private String orderSn;

    /**
     * 用户ID
     */
    private Long userId;

    /**
     * 订单类型（0配送、1自取）
     */
    private Integer type;

    /**
     * 收货人ID
     */
    private Long consigneeId;

    /**
     * 订单状态（0待付款、1待发货、2待取件、3待评价、4已完成、5已退款）
     */
    private Integer orderState;

    /**
     * 支付状态（0待付款、1已付款、2已退款、3付款失败）
     */
    private Integer payState;

    /**
     * 备注
     */
    private String remark;

    /**
     * 预留电话
     */
    private String mobile;

    /**
     * 商品总价
     */
    private BigDecimal goodsPrice;

    /**
     * 打包费用
     */
    private BigDecimal packPrice;

    /**
     * 配送费用
     */
    private BigDecimal freightPrice;

    /**
     * 订单总价
     */
    private BigDecimal orderPrice;

    /**
     * 自取时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    private Date takesTime;

    /**
     * 下单时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    private Date orderTime;

    /**
     * 支付时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    private Date payTime;

    /**
     * 收货时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    private Date receivingTime;

    /**
     * 退款时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    private Date refundTime;

    /**
     * 订单商品列表
     */
    @TableField(exist = false)
    private List<ShopOrderGoods> shopOrderGoodsList;
}